﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="POP3Edit.aspx.cs" Inherits="doris.Admin.POP3Edit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataSourceID="SqlDataSource1" Height="50px" Width="125px" 
        DataKeyNames="ConfigurationMailID" CssClass="dorisDetail">
        <Fields>
            <asp:BoundField DataField="ConnectionName" HeaderText="Navn" />
            <asp:BoundField DataField="Server" HeaderText="Server" />
            <asp:TemplateField Visible="false">
                <EditItemTemplate>
                    <asp:HiddenField ID="UseCredentials"  runat="server" Value='<%# Bind("UseCredentials") %>'></asp:HiddenField>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:HiddenField ID="UseCredentials"  runat="server" Value='<%# Bind("UseCredentials") %>'></asp:HiddenField>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Username" HeaderText="Brukernavn" />
            <asp:BoundField DataField="Password" HeaderText="Passord" />
            <asp:BoundField DataField="Port" HeaderText="Port" />
            <asp:TemplateField HeaderText="Bruk SSL">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbUseSSL" runat="server" Checked='<%# Convert.ToBoolean(Eval("UseSSL")) %>' />
                    <asp:HiddenField ID="UseSSL" runat="server" Value='<%# Bind("UseSSL") %>' />
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:CheckBox ID="cbUseSSL" runat="server" />
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbUseSSL" Enabled="false" runat="server" Checked='<%# Convert.ToBoolean(Eval("UseSSL")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Aktiv">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbEnabled" runat="server" Checked='<%# Convert.ToBoolean(Eval("Enabled")) %>' />
                    <asp:HiddenField ID="Enabled" runat="server" Value='<%# Bind("Enabled") %>' />
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:CheckBox ID="cbEnabled" runat="server"  />
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbEnabled" Enabled="false" runat="server" Checked='<%# Convert.ToBoolean(Eval("Enabled")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Email" HeaderText="Email" />
            <asp:CommandField ShowInsertButton="true" ShowEditButton="True" />
        </Fields>
        <HeaderTemplate>
            Konfigurer POP3
        </HeaderTemplate>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:localConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:localConnectionString.ProviderName %>" 
        InsertCommand="addPop3" InsertCommandType="StoredProcedure" 
        SelectCommand="getMail" SelectCommandType="StoredProcedure" 
        UpdateCommand="storeMail" UpdateCommandType="StoredProcedure" 
        OnUpdating="DetailsView1_ItemUpdating" 
        oninserted="SqlDataSource1_Inserted" 
        oninserting="SqlDataSource1_Inserting">
        <SelectParameters>
            <asp:QueryStringParameter Name="in_configurationmailid" QueryStringField="id" 
                Type="Int32" DefaultValue="0" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="in_server" Type="String" />
            <asp:Parameter Name="in_connectionname" Type="String" />
            <asp:Parameter Name="in_usecredentials" Type="Object" />
            <asp:Parameter Name="in_username" Type="String" />
            <asp:Parameter Name="in_password" Type="String" />
            <asp:Parameter Name="in_port" Type="Int32" />
            <asp:Parameter Name="in_usessl" Type="Object" />
            <asp:Parameter Name="in_enabled" Type="Object" />
            <asp:Parameter Name="in_email" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="in_configurationmailid" Type="Int32" />
            <asp:Parameter Name="in_server" Type="String" />
            <asp:Parameter Name="in_connectionname" Type="String" />
            <asp:Parameter Name="in_usecredentials" Type="Int16" />
            <asp:Parameter Name="in_username" Type="String" />
            <asp:Parameter Name="in_password" Type="String" />
            <asp:Parameter Name="in_port" Type="Int32" />
            <asp:Parameter Name="in_usessl" Type="Int16" />
            <asp:Parameter Name="in_enabled" Type="Int16" />
            <asp:Parameter Name="in_email" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:HyperLink ID="HyperLink1" runat="server" 
        NavigateUrl="~/Admin/MailConfig.aspx">Tilbake</asp:HyperLink>
</asp:Content>
